from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
from sqlalchemy import Column, BIGINT, String, ForeignKey
from sqlalchemy.orm import relationship

from web import Base
from web.model.Classify import Classify

class Agent(Base):
    __tablename__ = 'agent'
    id = Column(BIGINT, primary_key=True,autoincrement= True)
    name =  Column(String(50))
    descs =  Column(String(250))
    images =  Column(String(250))
    url =  Column(String(250))
    classify_id = Column(BIGINT,ForeignKey('classify.id'))
    classify = relationship(Classify)

class AgentSchema(SQLAlchemyAutoSchema):
    class Meta:
        model = Agent
        load_instance = True

    # 主要用于响应Agent的json数据
agentSchema = AgentSchema()


